<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>事件绑定</title>
    <script>
        function f1(){
            alert("静态绑定");
        }
    </script>
</head>
<body>
<button ondblclick="f1()">静态绑定</button><br/>
<!--
    在JS代码中对某一个元素绑定指定的事件
-->
<button id="btn">动态绑定</button><br/>
<script>
    document.getElementById("btn").onclick = function(){
        alert("动态绑定");
    }
</script>
</body>
</html>